<template>
  <div class="right1">
    <div class="title">
      <span class="word">个性配置</span>
    </div>
    <div class="line"></div>
    <div class="middle">
      <div class="midTop">
        <div>平台名称</div>
        <el-button @click="(Pname = true), (platform = true)" v-show="platform == false">修改</el-button>
        <el-button @click="(Pname = false), (platform = false)" v-show="platform == true">保存</el-button>
      </div>
      <div class="tit">
        <span>中文:</span>
        <span v-if="Pname == false">{{ chinas }}</span>
        <el-input v-if="Pname == true" v-model="chinas"></el-input>
      </div>
      <div class="tit">
        <span>英文:</span>
        <span v-if="Pname == false">{{ englishs }}</span>
        <el-input v-if="Pname == true" v-model="englishs"></el-input>
      </div>
      <div class="line2"></div>
    </div>
    <div class="middle">
      <div>
        <span>平台色系选择</span>
      </div>
      <div class="color">
        <el-radio-group v-model="radio1" class="ml-4 radios">
          <el-radio label="1" size="large" class="radi">
            <ul>
              <li>
                <span>基调色</span>
                <p class="p1"></p>
              </li>
              <li>
                <span>基调色</span>
                <p class="p2"></p>
              </li>
              <li>
                <span>基调色</span>
                <p class="p3"></p>
              </li>
              <li>
                <span>基调色</span>
                <p class="p4"></p>
              </li>
            </ul>
          </el-radio>
          <el-radio label="2" size="large">
            <ul>
              <li>
                <span>基调色</span>
                <p class="p1"></p>
              </li>
              <li>
                <span>基调色</span>
                <p class="p2"></p>
              </li>
              <li>
                <span>基调色</span>
                <p class="p3"></p>
              </li>
              <li>
                <span>基调色</span>
                <p class="p4"></p>
              </li>
            </ul>
          </el-radio>
        </el-radio-group>
      </div>
      <div class="line2"></div>
      <div class="bottom">
        <div class="midTop">
          <div>平台文件交互</div>
          <el-button @click="(change), (files = true)" v-show="files == false">修改</el-button>
          <el-button @click="(change), (files = false)" v-show="files == true">保存</el-button>
        </div>
        <div>
          <div>
            <span>系统简介</span>
            <div class="titcont">
              <div class="contentTit">
                <span id="div1">{{ xinxi }}</span>
                <div class="btn" v-if="files == false">
                  <el-button type="text" @click="aaa(xinxi)">预览
                  </el-button>
                  <el-button type="text" @click="downloadFile(xinxi, xinxi.substr(-10))">
                    下载</el-button>
                </div>
                <div class="btn" v-if="files == true">
                  <el-button type="text" @click="del(xinxi)">删除</el-button>
                  <el-upload style="display:inline-block" class="avatar-uploader"
                    action="http://oao.zhichengshangxin.com/UploadsFile" :show-file-list="false" ref="uploadRef"
                    :on-success="handleAvatarSuccess" :before-upload="beforeAvatarUpload">
                    <el-button type="text"> 上传</el-button>
                  </el-upload>

                </div>
              </div>
              <div class="box">
                <div class="leave">
                  <span>请问请问请问请问请问请问请问</span>
                </div>
              </div>
            </div>
          </div>
        </div>
        <div class="box2">
          <div>
            <span>使用说明</span>
            <div class="titcont">
              <div class="contentTit">
                <span id="div2">{{ xinxi1 }}</span>
                <div class="btn" v-if="files == false">
                  <el-button type="text" @click="aaa(xinxi1)">预览
                  </el-button>
                  <el-button type="text" @click="downloadFile(xinxi1, '1.pdf')">
                    下载</el-button>
                </div>
                <div class="btn" v-if="files == true">
                  <el-button type="text" @click="del(xinxi1)">删除</el-button>
                  <el-upload style="display:inline-block" class="avatar-uploader"
                    action="http://oao.zhichengshangxin.com/UploadsFile" :show-file-list="false" ref="uploadRef"
                    :on-success="handleAvatarSuccess1" :before-upload="beforeAvatarUpload">
                    <el-button type="text"> 上传</el-button>
                  </el-upload>
                </div>
              </div>
              <div class="box">
                <div class="leave">
                  <span>57676gyhbhbjhbhjbhbhbhjbhbhjbjhbhbj</span>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import FileSaver from 'file-saver';
import { ref } from "vue"
let mod = ref(false)
let uploadRef = ref(false)
let Pname = ref(false)
let xinxi = ref('https://img0.baidu.com/it/u=906452623,4137503095&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500')
let xinxi1 = ref('https://cdn.shopify.com/s/files/1/1545/3617/files/SH01_User_Manaul.pdf')

let platform = ref(false)

let files = ref(false)

let chinas = ref("OAO线上+线下智慧陪伴式运维")

let englishs = ref("Online and Offline Accompanying Smart Operation")

let radio1 = ref("1")
function downloadFile(data, name) {
  FileSaver.saveAs(data, name);
}
const handleAvatarSuccess = (res) => {
  console.log(res);
  xinxi.value = 'http://oao.zhichengshangxin.com/' + res.data
}
const del = (oa) => {
  oa.value = ''
}
const handleAvatarSuccess1 = (res) => {
  // console.log(res);
  xinxi1.value = 'http://oao.zhichengshangxin.com/' + res.data
}
function aaa(data) {
  window.open(data, '_blank');
}
const change = () => {
  mod.value = !mod.value
}
</script>

<style scoped lang="less">
#div1 {
  overflow: hidden;
  text-overflow: ellipsis; //超出部分以省略号显示
  white-space: nowrap;
  width: 10em; //用px单位亦可行
}

#div2 {
  overflow: hidden;
  text-overflow: ellipsis; //超出部分以省略号显示
  white-space: nowrap;
  width: 10em; //用px单位亦可行
}

.tit .el-input {
  width: 379px;
}

ul {
  list-style: none;
  margin-left: 10px;

  li {
    float: left;
    margin-right: 15px;
    font-family: SourceHanSansSC;
    font-weight: 400;
    font-size: 12px;
    color: rgb(127, 127, 127);
    font-style: normal;
    letter-spacing: 0px;
    line-height: 22px;
    text-decoration: none;

    .p1 {
      border-radius: 4px;
      width: 39px;
      background-color: rgb(81, 99, 167);
      height: 20px;
    }

    .p2 {
      width: 39px;
      border-radius: 4px;
      background-color: rgb(240, 149, 61);
      height: 20px;
    }

    .p3 {
      width: 39px;
      border-radius: 4px;
      background-color: rgb(147, 170, 222);
      height: 20px;
    }

    .p4 {
      width: 39px;
      border-radius: 4px;
      background-color: rgb(235, 242, 250);
      height: 20px;
    }
  }
}

.color {
  margin-top: 30px;
}

.right1 {
  width: 100%;
  height: 100%;
  background-color: white;
  border-style: none;
  border-color: unset;
  box-shadow: rgb(77 98 165 / 10%) 0px 5px 20px 0px;
  border-radius: 8px;
  font-size: 14px;
  padding: 0;
  line-height: 20px;
  font-weight: normal;
  font-style: normal;

  .title {
    padding: 20px;

    .word {
      font-family: SourceHanSansSC;
      font-weight: 550;
      font-size: 20px;
      color: rgb(77, 98, 165);
      font-style: normal;
      letter-spacing: 2px;
      line-height: 28px;
      text-decoration: none;
    }
  }

  .line {
    border-bottom: 2px rgba(77, 98, 165, 0.2) solid;
  }

  .middle {
    font-family: SourceHanSansSC;
    font-weight: 400;
    font-size: 16px;
    color: rgb(127, 127, 127);
    font-style: normal;
    letter-spacing: 0px;
    line-height: 22px;
    text-decoration: none;
    padding: 10px;
    width: 100%;

    .midTop {
      display: flex;
      justify-content: space-between;
      margin-bottom: 28px;

      .el-button {
        width: 104px;
        height: 30px;
        z-index: 698;
        background-color: rgb(147, 170, 222);
        color: white;
      }
    }

    .line2 {
      width: 100%;
      padding-left: 40px;
      padding-right: 40px;
      border-bottom: dashed rgb(220, 224, 238) 1px;
      height: 1px;
      margin: auto;
      margin: 36px 0px 20px 0px;
    }

    .tit {
      // margin-top: 28px;
      font-family: SourceHanSansSC;
      font-weight: 550;
      font-size: 14px;
      color: rgb(127, 127, 127);
      font-style: normal;
      letter-spacing: 0px;
      line-height: 32px;
      text-decoration: none;
    }
  }

  .middle {
    font-family: SourceHanSansSC;
    font-weight: 400;
    font-size: 16px;
    color: rgb(127, 127, 127);
    font-style: normal;
    letter-spacing: 0px;
    line-height: 22px;
    text-decoration: none;
    padding: 20px;
  }

  .bottom {
    // background-color: thistle;
    margin-top: 30px;

    .contentTit {
      display: flex;

      .btn {
        margin-left: 60px;

        .el-button {
          padding-bottom: 20px;
        }
      }
    }

    .box {
      height: 83px;
      border: 1px solid rgb(204, 204, 204);
      border-radius: 3px;
    }

    .box2 {
      margin-top: 20px;
    }

    .titcont {
      margin-top: 10px;
    }

    .leave {
      padding: 10px;

      span {
        font-family: SourceHanSansSC;
        font-weight: 400;
        font-size: 14px;
        color: rgb(126, 126, 126);
        font-style: normal;
        letter-spacing: 0px;
        line-height: 20px;
        text-decoration: none;
      }
    }
  }
}

// /deep/.el-button>span {
//     color: white;
//     display: inline-flex;
//     align-items: center;
// }
</style>
